﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace TSCC.Service
{
    public class UserInfo : Interface.iUser 
    {
        string employeeNo = string.Empty;
        string team = string.Empty;
        string userName = string.Empty;
        bool isCSR = true;

        public UserInfo(DataTable p_dt,string p_pw)
        {
            employeeNo = p_dt.Rows[0]["員編"].ToString();
            team = p_dt.Rows[0]["組別"].ToString();
            userName = p_dt.Rows[0]["姓名"].ToString();
            if (p_pw.Length > 0)
            {
                if(!DBNull.Value.Equals(p_dt.Rows[0]["PW"]))
                {
                    if (p_dt.Rows[0]["PW"].ToString().Equals(p_pw))
                    {
                        isCSR = false;
                    }
                }
                //isCSR = DBNull.Value.Equals(p_dt.Rows[0]["PW"]) ? true : false;    
            }
            
        }

        #region iUser Members

        public string GetEmployeeNo()
        {
            return employeeNo;
        }

        public string GetTeam()
        {
            return team;
        }

        public string GetUserName()
        {
            return userName;
        }

        public bool IsCSR()
        {
            return isCSR;
        }

        #endregion
    }
}
